﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Cheenti.UserControls
{
    public partial class TextSlides : System.Web.UI.UserControl
    {
        public event EventHandler PageChanged;

        private int _currentPage = 1;
        public int CurrentPage
        {
            get
            {

                this._currentPage = (int)Session["pageIndex"];
                return this._currentPage;
            }
            set
            {
                Session["pageIndex"] = this._currentPage = value;
            }
        }

        public object DataSource
        {
            get
            {
                return this.Repeater1.DataSource;


            }
            set
            {
                this.Repeater1.DataSource = value;
            }
        }

        public override void DataBind()
        {
            //base.DataBind();
            //if (!Page.IsPostBack)
            this.Repeater1.DataBind();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Session["pageIndex"] = this._currentPage;
            }
        }

        //protected void LinkButton1_Click(object sender, EventArgs e)
        //{
        //    this.CurrentPage = 1;
        //    if (PageChanged != null)
        //    {
        //        this.PageChanged(sender, e);
        //    }
        //}

        //protected void LinkButton2_Click(object sender, EventArgs e)
        //{
        //    this.CurrentPage--;
        //    if (PageChanged != null)
        //    {
        //        this.PageChanged(sender, e);
        //    }
        //}

        //protected void LinkButton3_Click(object sender, EventArgs e)
        //{
        //    this.CurrentPage++;
        //    if (PageChanged != null)
        //    {
        //        this.PageChanged(sender, e);
        //    }
        //}

        //protected void LinkButton4_Click(object sender, EventArgs e)
        //{
        //    this.CurrentPage = System.Int32.MaxValue;
        //    if (PageChanged != null)
        //    {
        //        this.PageChanged(sender, e);
        //    }
        //}
    }
}